#ifndef LFMPOSTDATABUILDER_H
#define LFMPOSTDATABUILDER_H

#include<QPointer>
#include<QString>

class Song;

class LFMPostDataBuilder{
public:
	enum LFMParams{
		NONE = 0x00,
		TRACK = 0x01,
		ARTIST = 0x02,
		ALBUM = 0x04,
		TIMESTAMP = 0x08,
		SESSION_KEY = 0x10,
		SIGNATURE = 0x20
	};
	
	LFMPostDataBuilder(const QString &sessionKey);
	
	static QString api_key(){ return LFMPostDataBuilder::API_KEY; }
	
	void setSessionKey(const QString &sessionKey);
	bool canScrobble()const{ return !m_sessionKey.isEmpty(); }
	
	QString build(const QString &methodName, QPointer<Song> song, unsigned params, const QString &timestamp = QString());
	QString buildAuthData(const QString &methodName, const QString &token = QString());
private:
	QString m_sessionKey;
	const static QString API_KEY;
	const static QString SECRET_KEY;
	
	QString signature(const QString &postData);
};

#endif
